home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
Audio dcmds
/
Audio CD dcmds.sit
/
Audio CD dcmds.π
/
Sample dcmd
/
dcmd.c
< prev
next >
Wrap
Text File
|
1994-08-30
|
1KB
|
69 lines
/*****************************************************
bin.c P. Stadelmann, June 1994
Displays a long word in binary.
*****************************************************/
#include <SetUpA4.h>
#include <Think_dcmd.h>
#include <Think_put.h>
void DoHelp( void )
{
PutPStr( "\pbin num");
PutLine();
PutPStr( "\p Displays the value in num as a binary long.");
PutLine();
}
void DoJob()
{
long value;
Boolean ok;
Str255 myStr;
short pos;
if ( dcmdPeekAtNextChar() == '\r' )
PutPStr( "\pValue not found" );
else
{
pos = dcmdGetPosition();
dcmdGetNextExpression( &value, &ok );
if (ok)
{
dcmdSetPosition( pos );
dcmdGetNextParameter( myStr );
PutPStr( myStr );
PutPStr( "\p = ");
PutBinary(value, 32);
}
else
PutPStr( "\pSyntax error");
}
PutLine();
}
pascal void CommandEntry( dcmdBlock* paramPtr )
{
RememberA0();
SetUpA4();
switch ( paramPtr->request )
{
case dcmdInit : break;
case dcmdHelp : DoHelp();
break;
case dcmdDoIt : DoJob();
break;
}
RestoreA4();
}